﻿using TopHero;
using UnityEngine;
using View;

public class UnityViewService : IViewService
{
    private IViewObject CreateView<T>() where T : UnityObject
    {
        GameObject gameObject = new GameObject(typeof(T).Name);
        var view = gameObject.AddComponent<T>();
        return view;
    }

    public IViewObject CreateHeroView()
    {
        return CreateView<HeroUnityObject>();
    }

    public IViewObject CreateEmptyCellView()
    {
        return CreateView<CellUnityObject>();
    }

    public IViewObject CreateRoadCellView()
    {
        return CreateView<RoadUnityObject>();
    }

    public IViewObject CreatePrefabView(int prefabId)
    {
        GameObject gameObject = new GameObject("PrefabUnityObject");
        PrefabUnityObject view = gameObject.AddComponent<PrefabUnityObject>();
        view.prefabId = prefabId;
        return view;
    }
}